package org.wsff.tools.api.gateway.manager;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * ProviderChangedEvent
 * @author ryan
 * @version Id: ProviderChangedEvent.java, v 0.1 2022-01-19 18:21 ryan Exp $$
 */
@Data
public class ProviderChangedEvent implements Serializable {
    private static final long serialVersionUID = 8095529941062968217L;

    /** proxy name */
    private String            name;

    /** change type */
    private String            type;

    public enum ChangeType {

                            RELOAD, OFFLINE;

        private static Map<String, ChangeType> MAP = new HashMap<>();

        static {
            for (ChangeType value : ChangeType.values()) {
                MAP.put(value.name(), value);
            }
        }

        public static ChangeType getByCode(String code) {
            return MAP.get(code);
        }
    }

}
